# Make a prediction function
makePredict = function(theModel, theVar) {
  meanob = nscd_all %>% dplyr::select(nAttend, numMil, numDef, numInt, numState, meanHawk, presHawk, advHawk,
                                      totDip, totInt, totMil, usmidschallenge5, cinc, contains("mention"))
  meanob = data.frame(t(apply(meanob, 2, mean, na.rm=T)))
  meanob$admin = "Eisenhower"
  meanobs = rbind(meanob, meanob)
  meanobs$formal = 1
  
  meanobs[,theVar] = c(quantile(nscd_all[,..theVar], 0.00, na.rm=T), quantile(nscd_all[,..theVar], 1, na.rm=T))
  
  predict(theModel, newdata=meanobs, type="response")
  predict(theModel, newdata=meanobs, type="response") 
}
